package Control;

import javax.swing.ImageIcon;
import javax.swing.JOptionPane;

import Entity.MsgPackage;
import GUI.FreezeRequest;
import GUI.ScreenManager;

public class FreezeRequestControl {
	private FreezeRequest freezeGui;
	private MsgPackage freezeMsg;
	private String data;
	
	public FreezeRequestControl(){
		freezeGui= new FreezeRequest();
		freezeMsg= new MsgPackage();
	}
	
	public FreezeRequest getFreezeRequestGui(){
		return freezeGui; 
	}
	
	public boolean submit_press(){
		String x= (String)freezeGui.getReqNum().getSelectedItem();
		if(x==null){
			JOptionPane.showMessageDialog(null, "Not all the fileds all the fill", "ERROR", JOptionPane.ERROR_MESSAGE);
			return false;
		}
		else{
			freezeMsg.setObject(x);
			freezeMsg.setOp_code(OP_CODE.FREEZE_REQ);
			ScreenManager.getConnection().accept(freezeMsg);
			JOptionPane.showMessageDialog(null, "The request status was updated successfully", "", JOptionPane.INFORMATION_MESSAGE);

			return true;
		}
	}

}
